package com.imay.live.adapter.family;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.imay.live.R;
import com.imay.live.activity.family.util.LevelUtil;
import com.imay.live.model.UserExpsBean;

import java.util.List;

/**
 * Created by Administrator on 2017/9/8 0008.
 */

public class FamilyUserLevelAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {

    public final static int VIEWTYPE_LINEAR_CONTENT = 0x114;//推荐结果

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public FamilyUserLevelAdapter(List<MultiItemEntity> data) {
        super(data);
        addItemType(VIEWTYPE_LINEAR_CONTENT, R.layout.item_family_user_level);
    }

    @Override
    protected void convert(BaseViewHolder helper, MultiItemEntity item) {
        if (item.getItemType() == VIEWTYPE_LINEAR_CONTENT) {
            UserExpsBean expsBean = (UserExpsBean) item;
            helper.setText(R.id.tv_user_level_lv, expsBean.getLv());
            helper.setText(R.id.tv_user_level_title, expsBean.getTitle());
            helper.setTextColor(R.id.tv_user_level_title, mContext.getResources().getColor(LevelUtil.getLevelColor(expsBean.getLevel())));
        }
    }
}